<template>
  <van-dialog
    v-model="dialogShow"
    :title="title"
    show-cancel-button
    confirm-button-color="#3A7DFF"
    @confirm="submitData"
    @cancel="showDialog"
  >
    <div class="inputbox">
      <el-input v-model="value" clearable />
    </div>
  </van-dialog>
</template>

<script>
export default {
  name: 'ComDialog',
  props: {
    show: {
      type: Boolean,
      default: false
    },
    num:{
      type:[Number,String],
      default:0
    },
    title: {
      type: String,
      required: true
    }
  },
  computed:{
    dialogShow:{
      get(){
        return this.show
      },
      set(v){
        this.$emit('update:show',!this.show)
      }
    }
  },
  watch:{
    num(val){
      this.value = val
    },
  },
  data() {
    return {
      value:this.num,
      showModal:false
    }
  },
  methods: {
    submitData(){
      this.$emit('confirm',this.value)
    },
    showDialog() {
      // this.dialogShow = !this.dialogShow
      this.$emit('compete',this.value)
    }
  }
}
</script>

<style lang="scss" scoped>
.inputbox {
  padding: 20px 58px;
}
</style>